Add composite action to cache CI apt installs#171735
Open
bdraco wants to merge 6 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Home Assistant Core CI workflow to use awalsh128/cache-apt-pkgs-action for apt package caching/installation to reduce flaky apt installs, and adjusts the base job to provision uv via setup-uv on venv cache misses.
Changes:
- Replace the previous custom apt cache directory +
actions/cacherestore/save approach withawalsh128/cache-apt-pkgs-actionacross jobs. - Add
APT_CACHE_VERSIONto control apt cache invalidation centrally. - On base venv cache misses, read the pinned
uvversion fromrequirements.txtand installuvviaastral-sh/setup-uv, removing the explicitpip install uv...bootstrap step.
The action restores cached .deb files to disk but skips dpkg-trigger so /etc/ld.so.cache stays stale and ctypes-based loaders (eg opuslib) cannot find libopus.so.0. Add an explicit ldconfig step after each action call.
Wrap awalsh128/cache-apt-pkgs-action in .github/actions/cache-apt-packages so every job uses the same pattern, and route /usr/lib/x86_64-linux-gnu subdirectories through ldconfig. The upstream action does not run postinst on cache restore so update-alternatives symlinks (libblas, liblapack via ffmpeg) never appear; adding the subdirs to ld.so.conf.d lets the linker find the real libraries without those symlinks.
21 tasks
So the ldconfig workaround also works on non-x86_64 runners.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed change
apt installs on CI are flakey, especially on the database runners that hit an external mirror with no retry. Add a
cache-apt-packagescomposite action under.github/actions/so every workflow installs apt packages through one entry point. The composite removes the conflicting Microsoft apt source, restores from cache when possible, and refreshes the dynamic linker soupdate-alternativessymlinks (eglibblas,liblapackvia ffmpeg) keep resolving after a cache restore. The library path is derived fromdpkg-architectureso it stays correct on non-x86_64 runners. Workflows do not pin a third-party action directly, so the implementation can be swapped later without touching each workflow. Under the hood it delegates toawalsh128/cache-apt-pkgs-action, which esphome already uses in production.setup-uvbootstrapsuvon cache miss so the venv no longer needs base pip.Setup is faster as a bonus, PR vs recent dev:
Postgres only saves 3s because the pgdg setup script still has to run. Total across a full CI matrix is roughly 5 to 6 minutes of compute per PR.
Type of change
Additional information
Checklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all.To help with the load of incoming pull requests: